 <html>
 <head>
     <link rel="stylesheet" href="../../static/style/wordEdite.css">
 </head>
 <body>
 <div  id="uploadImg" style="visibility: none;"  >
     
     <div id="showImge">
         <img src="../../static/img/-.png" alt="" class="Smedia" >
     </div>
     <!-- 下面的input不能放在上面div中 否则在显示时会冲洗掉他。 -->

     <input type="file" name="file"   id="ImageFile" onchange="showUpFile()" >

     
     <script>
         window.onload=function () {
         	  
             var innerFrame=window.parent
              console.log(innerFrame.document.getElementsByClassName("edui-for-insertimage"),100)
              
              getViewWidth=innerFrame.document.getElementById("editor").offsetWidth
              innerFrame.document.getElementById("edui130_body").style.width=getViewWidth/2+"px"
              
              innerFrame.document.getElementById("edui130_body").style.top=130+"px"
              
               innerFrame.document.getElementById("edui130_body").style.height=getViewWidth/2+30+"px"
               
              getBodyWidth=innerFrame.document.body.clientWidth
              innerFrame.document.getElementById("edui130").style.left=(getBodyWidth/2-getViewWidth/4)+"px"
              
              innerFrame.document.getElementById("edui130_iframe").style.width=getViewWidth/2+"px"
              innerFrame.document.getElementById("edui130_content").style.height=(getViewWidth/2)-20-40+"px"
              if(getViewWidth>800)
              {
              	innerFrame.document.getElementById("edui130_iframe").style.width=getViewWidth/2+"px"
              	 innerFrame.document.getElementById("edui130_body").style.top=50+"px"
              	innerFrame.document.getElementById("edui130_content").style.height=(getViewWidth/2)-30-80+"px"
              	innerFrame.document.getElementById("edui130_body").style.height=getViewWidth/2-30+"px"
              	nexSi=document.getElementById("showImge")
              	element=document.createElement("input")
              	element.setAttribute("type","text")
                element.setAttribute("placeholder","请指定文件")
              	element.setAttribute("id","uploadImageTitle")

              	nexSi.parentElement.insertBefore(element,nexSi)
              	}
              console.log(getViewWidth)
               //innerFrame.document.getElementById("edui130_body").getElementsByClassName("edui-dialog-shadow")[0].style.height=getViewWidth/2+"px"
              
              console.log(innerFrame.document.getElementById("edui130_body").getElementsByClassName("edui-dialog-shadow"))
              
              //innerFrame.document.getElementById("edui130_body").getElementsByClassName("edui-dialog-shadow")[0].style.width=getViewWidth/2+10+"px"

              //innerFrame.document.getElementsByClassName("edui-for-insertimage")[2].style
             var yes=innerFrame.document.getElementById('edui134_body').getElementsByClassName("edui-label")[0]
             
             //innerFrame.document.getElementById('edui134_body').setAttribute("onclick","")
             //yes.style.width=getViewWidth*0.2+"px"
             yes.style.height=getViewWidth*0.1+"px"

             var no=innerFrame.document.getElementById('edui135_body').getElementsByClassName("edui-label")[0]
             
             // no.style.width=getViewWidth*0.2+"px"
            

             
             
             no.style.height=getViewWidth*0.1+"px"
             console.log(yes)
             no.setAttribute("onclick","cancelUp()")
             yes.setAttribute("onclick","uploadMedia()")
             console.log(1009)
             console.log(yes)
         }
      function showUpFile()
      {
        
        var upFile=document.getElementById("ImageFile")
        var url = window.URL.createObjectURL(upFile.files[0])
        var el=document.getElementById("showImge")
        var fileName=upFile.value
        console.log(url,fileName)
        if (fileName.indexOf(".mp4")!=-1)
        {
            el.innerHTML="<video class='Smedia' controls='controls'  src='"+url+"'/>"
        }
        else if (fileName.indexOf(".jpg")!=-1||fileName.indexOf(".jpeg")!=-1||fileName.indexOf(".png")!=-1||fileName.indexOf(".gif")!=-1)
        {
            console.log(89)
            el.innerHTML="<img class='Smedia' src='"+url+"'/>"
        }
        else if (fileName.indexOf(".mp3")!=-1)
        {
            el.innerHTML="<audio class='Smedia' controls='controls' src='"+url+"'/></audio>"
        }
        else
        {
            el.innerHTML="<a class='Smedia' href='"+url+"''>"+fileName.replace("C:\\fakepath\\","")+"</a>"
        }
      }


     </script>

 </div>
 </body>
 </html>

